-----------------------------------------------------------------------环境配置--------------------------------------------------
GLOBAL.setmetatable(env, {
    __index = function(t, k)
        return GLOBAL.rawget(GLOBAL, k)
    end
})
--万能密码，设置环境，不需要使用GLOBAL，加就完事
--如需获取modinfo的设置使用GetModConfigData("EnableWeaponn")

PrefabFiles = {}
Assets = {}


-------------------------------------------------------资源注册------------------------------------------------------------------
local imageassets = 
{--物品栏图片资源,默认路径在images/inventoryimages下

}
local minimaplist = 
{--小地图资源,默认路径在images/map_icons下

}


local soundassets = 
{--声音资源,默认路径在sounds下

}

local animassets = 
{--动画资源,默认路径在anim路径下

}

local prefabassets = 
{--预设物文件，默认在prefabs路径下

}


local tab = {}--用于小木牌资源注册
for k,v in pairs(imageassets) do
    table.insert(Assets, Asset('ATLAS', "images/inventoryimages/"..v..".xml"))
    table.insert(Assets, Asset('IMAGE', "images/inventoryimages/"..v..".tex"))
    table.insert(Assets, Asset('ATLAS_BUILD', "images/inventoryimages/"..v..".xml",256))--小木牌注册，后面的256猜测是图片分辨率，即256*256
    RegisterInventoryItemAtlas('images/inventoryimages/'..v..'.xml',v..'.tex')  --在inventoryItemAtlasLookup表中注册图集对应关系，注册之后可以让其他mod知道你的贴图路径
    
    tab[v] =resolvefilepath_soft("images/inventoryimages/"..v..".xml")  --手动将文件路径存入memoizedFilePaths缓存中，用于通知系统文件路径
end

local DrawingTool = require("components/drawingtool")--小木牌的工具
local OldGetTmageToDraw = DrawingTool.GetImageToDraw
function DrawingTool:GetImageToDraw(target)
    local image,ent,atlas,bgimage,bgatlas = OldGetTmageToDraw(self,target)
    if image and tab[image] then
        atlas = tab[image]
    end
    return image,ent,atlas,bgimage,bgatlas
end


for k,v in pairs(minimaplist) do  --小地图资源注册
    table.insert(Assets, Asset('ATLAS', "images/map_icons/"..v..".xml"))
    AddMinimapAtlas('images/map_icons/'..v..'.xml')
end



for k,v in pairs(prefabassets) do
    table.insert(PrefabFiles, v)
end



---------------------------------------------------------------------------------------------导入内容---------------------------------------------------
modimport("scripts/main/TS_TUNING")                      -- mod常量设置
modimport("scripts/main/TS_HOOK")                        -- 钩子函数
modimport("scripts/main/TS_DATA")                        -- 数据库



